#include "IceList.h"
#include "stdio.h"
#include "IceSharePtr.h"

class A
{
public:
	A(int i)
	{
		a = i;
		printf("constructed == %d    ", a);
	}

	~A()
	{
		printf("destructed == %d    ", a);
	}

	int Get()
	{
		return a;
	}

	int a = 0;
};

int main()
{
	IceList<int> lst;
	lst.DoPushBack(1);
	lst.DoPushBack(3);
	lst.DoPushFront(33);
	for (IceList<int>::Iterator it = lst.GetBegin(); it != lst.GetEnd();)
	{
		printf("%d\n", *it);
		it = lst.DoErase(it);
	}
	lst.DoPushFront(33333);
	for (IceList<int>::Iterator it = lst.GetBegin(); it != lst.GetEnd(); ++it)
	{
		printf("aaa = %d\n", *it);
	}

	IceSharePtr<A> sharePtr3(new A(3));
	printf("sharePtr3 = %d\n", sharePtr3->Get());
	IceSharePtr<A> sharePtr4(new A(4));
	printf("sharePtr4 = %d\n", sharePtr4->Get());
	IceSharePtr<A> sharePtr5(sharePtr4);
	printf("sharePtr3 = %d\n", sharePtr3->Get());
	printf("sharePtr5 = %d\n", sharePtr5->Get());
	sharePtr5.DoReset(new A(7));
	sharePtr3.DoReset(new A(90));
	sharePtr4.DoReset(new A(909));

	while (1)
	{

	}
	return 0;
}